import Vue from '@/main.js';



export  function insertPopulation(insertForm) {
  var path = "/business/populationInformation/insert";

  console.log(insertForm)

  return Vue.$http.post(path, {
      phoneNumber: insertForm.phoneNumber,
      name: insertForm.name,
      gender: insertForm.gender,
      birthday: insertForm.birthday,
      nation: insertForm.nation,
      idCardType: insertForm.idCardType,
      idNumber: insertForm.idNumber,
      residentialStatus: insertForm.residentialStatus,
      homeAddress: insertForm.homeAddress,
      maritalStatus: insertForm.maritalStatus,
      isPartyMember: insertForm.isPartyMember,
      identityType: insertForm.identityType,
      educationLevel: insertForm.educationLevel,
      nationality: insertForm.nationality,
      nativePlace: insertForm.nativePlace,
      occupation: insertForm.occupation,
      company: insertForm.company,
      companyContacts: insertForm.companyContacts,
      companyAddress: insertForm.companyAddress,
      emergencyContact: insertForm.emergencyContact,
      notes: insertForm.notes,
      residentialIdArray:insertForm.residentialIdArray,
      specialCodeArray:insertForm.specialCodeArray
    })
    .then((res) => {
      console.log(res)
        return res.data;
    })
    .catch(function (error) {
      console.log(error);
    });
}

export  function updatePopulationInfo(insertForm) {
  var path = "/business/populationInformation/update";
  return Vue.$http.post(path, {
      id: insertForm.id,
      phoneNumber: insertForm.phoneNumber,
      name: insertForm.name,
      gender: insertForm.gender,
      birthday: insertForm.birthday,
      nation: insertForm.nation,
      idCardType: insertForm.idCardType,
      idNumber: insertForm.idNumber,
      residentialStatus: insertForm.residentialStatus,
      homeAddress: insertForm.homeAddress,
      maritalStatus: insertForm.maritalStatus,
      isPartyMember: insertForm.isPartyMember,
      identityType: insertForm.identityType,
      educationLevel: insertForm.educationLevel,
      nationality: insertForm.nationality,
      nativePlace: insertForm.nativePlace,
      occupation: insertForm.occupation,
      company: insertForm.company,
      companyContacts: insertForm.companyContacts,
      companyAddress: insertForm.companyAddress,
      emergencyContact: insertForm.emergencyContact,
      notes: insertForm.notes,
      residentialIdArray:insertForm.residentialIdArray,
      specialCodeArray:insertForm.specialCodeArray
    })
    .then((res) => {
      console.log(res)
        return res.data;
    })
    .catch(function (error) {
      console.log(error);
    });
}





export  function getPopulationList(params) {
  var path = "/business/populationInformation/list";

  return Vue.$http.post(path,params )
    .then((res) => {
        return res.data;
    })
    .catch(function (error) {
      console.log(error);
    });
}
export  function deletePopulationInformation(id) {
  var path = "/business/populationInformation/delete?id="+id;
  return Vue.$http.get(path)
    .then((res) => {
        return res.data;
    })
    .catch(function (error) {
      console.log(error);
    });
}



export  function getDictionaryList(category) {
  var path = "/business/dictionary/queryList?category="+category;
  return Vue.$http.get(path)
    .then((res) => {
        return res.data;
    })
    .catch(function (error) {
      console.error(error);
    });
}

export  function getPopulationDetail(id) {
  var path = "/business/populationInformation/detail?id="+id;
  return Vue.$http.get(path)
    .then((res) => {
        return res.data;
    })
    .catch(function (error) {
      console.error(error);
    });
}
